package com.kkang.ch2.profile;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author yongk_liu
 **/
public class Main {

    public static void main(String[] args) {
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext();

        applicationContext.getEnvironment().setActiveProfiles("dev");//environment的active属性为dev
        applicationContext.register(ProfileConfig.class);//后置注册bean，先置会报错Bean未定义
        applicationContext.refresh();//刷新容器，一个容器只能刷新一次

        DemoBean demoBean = applicationContext.getBean(DemoBean.class);
        System.out.println(demoBean.getContent());

        applicationContext.close();
    }

}
